package array.nowcoder.easy;

import java.util.Scanner;

/**
 * @author bruin_du
 * @description 洗牌
 * https://www.nowcoder.com/practice/5a0a2c7e431e4fbbbb1ff32ac6e8dfa0?
 * tpId=85&&tqId=29848&rp=1&ru=/activity/oj&qru=/ta/2017test/question-ranking
 * @date 2022/5/18 9:46
 **/
public class WashCard {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        while(in.hasNextInt()){
            int halfSize = in.nextInt();
            int size = halfSize * 2;
            int k = in.nextInt();
            int[] arr = new int[size];
            for(int i = 0 ; i < size ; i++){
                arr[i] = in.nextInt();
            }
            if(arr[0] != arr[size - 1]){
                for(int i = 0 ; i < k ; i++){
                    reverse(arr,halfSize,size);
                }
            }
            for(int i = 0 ; i < size ; i ++){
                System.out.print(arr[i]);
                if(i != size - 1)
                    System.out.print(" ");
            }
            System.out.println();
        }
    }
    public static void reverse(int[] arr,int halfSize,int size){
        int[] tmpArr = new int[size];
        int j = 0;
        for(int i = size - 1 ; i >= 0 ; i -= 2){
            tmpArr[i] = arr[size - j - 1];
            tmpArr[i - 1] = arr[halfSize - j - 1];
            j++;
        }
        for(int i = 0 ; i < size ; i++){
            arr[i] = tmpArr[i];
        }
    }
}
